package org.example.ims.Service.WarehouseProduct;

import org.example.ims.DTO.InventoryItemDTO;
import org.example.ims.DTO.ProductWithInventoryDTO;
import org.example.ims.DTO.StockInOutDTO;
import org.example.ims.Entity.Base.Product;
import org.example.ims.Entity.Base.Warehouse;
import org.example.ims.Entity.WareHouseProduct.WarehouseProduct;
import org.example.ims.Entity.WareHouseProduct.WarehouseProductId;
import org.springframework.data.domain.Page;
import org.springframework.transaction.annotation.Transactional;

import java.util.Optional;

public interface WarehouseProductService {

   WarehouseProduct createWarehouseProduct(WarehouseProduct warehouseProduct);

   Optional<WarehouseProduct> findById(WarehouseProductId id);

   Page<WarehouseProduct> searchWarehouseProducts(
           Integer warehouseId, Integer productId,
           Integer minStock, Integer maxStock,
           Integer page, Integer size);

    WarehouseProduct updateWarehouseProduct(WarehouseProduct warehouseProduct) ;

    void deleteWarehouseProduct(WarehouseProductId id) ;

    @Transactional
    void stockIn(Warehouse warehouse, StockInOutDTO<Product> inStockDTO);

    @Transactional
    void stockOut(Warehouse warehouse, StockInOutDTO<WarehouseProduct> outStockDTO);

    @Transactional
    void transferStock(Warehouse sourceWarehouse, Warehouse targetWarehouse,
                       StockInOutDTO<Product> inStockDTO, StockInOutDTO<WarehouseProduct> outStockDTO);

    Page<ProductWithInventoryDTO> searchProducts(Integer warehouseId,String status,Integer page, Integer size);
    Page<InventoryItemDTO> queryInventory(Integer warehouseId, Integer categoryId,
                                          String productStatus,String productName,
                                          Integer minStock, Integer maxStock,
                                          Integer page, Integer size);
}
